package com.pactera.madp.cp.api.em;

import com.pactera.madp.cp.api.em.medium.TypeEnum;

/**
 * WorkMassEnum
 *
 * @author jun
 * @version 1.0
 * 2021/7/29 18:10
 **/
public enum WorkMassEnum {

    STATUS_0(0,"未发送"),
    STATUS_1(1,"已发送"),
    STATUS_2(2,"因客户不是好友导致发送失败"),
    STATUS_3(3,"因客户已经收到其他群发消息导致发送失败");


    private Integer code;
    private String msg;

    WorkMassEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    /**
     * 根据 code 值获取对应的msg
     * @param code
     * @return msg
     */
    public static String getTypeByCode(Integer code) {
        WorkMassEnum[] values = values();
        for (WorkMassEnum e : values) {
            if (e.getCode() == code) {
                return e.getMsg();
            }
        }
        return "";
    }
}
